<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/includes.jsp" %>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>供应商编辑</title>
	<!-- import css and js --> 
	<%@ include file="/common/metaInput.jsp" %>  
	<script src="${ctx}/js/jsp/comm.js" type="text/javascript"></script>
<script type="text/javascript">
var basic_Url="${ctx}/basic/storage";
$(function(){
$("#inputForm").validate({			   
	onsubmit: true,
	 /*执行ajaxsubmit  */ 
    submitHandler: function(editform) {
            
        //alert(jsonInfo); 
        try{			    		
            url =  basic_Url+"/save.do";
            var api = frameElement.api;
        	var W = api.opener;
        
            getReturnMessage(url,"inputForm",W.searchAP);
        }catch(e){alert(e);}
    }
 }
);
}); 

$("#zd002SupeId").change(function(){
 	grid.loadData();
 	$("#zd003ZhName").val("");
	$("#zd010Email").val("");
	$("#zd006Contacts").val("");
	$("#zd008Phone").val("");
	$("#zd007Tel").val("");
	$("#zd011Fax").val("");
	$("#zd011Fax").val("");
	if(''!= $(this).val()){
		$.ajax({
		      url: basic_Url+"/getGysInfo.do",
		      global: false,
		      type: "POST",
		      dataType: "json",
		      data: ({
		    	  gysId : $(this).val()
		      }),		     
		      success: function(msg){
		    	if(undefined != msg && undefined != msg.gys && null != msg.gys){
		    		$("#zd003ZhName").val(msg.gys.zd003ZhName);
		    		$("#zd010Email").val(msg.gys.zd010Email);
					$("#zd006Contacts").val(msg.gys.zd006Contacts);
					$("#zd008Phone").val(msg.gys.zd008Phone);
					$("#zd007Tel").val(msg.gys.zd007Tel);
					$("#zd011Fax").val(msg.gys.zd011Fax);
					$("#zd011Fax").val(msg.gys.zd011Fax);
		    	}else{
		    		alert("返回对象为空");
		    	}
	   			
		      }
	   });
	}
});




function submitForm(param){
    //设置ajax全局同步
	jQuery.ajaxSettings.async = false;
  	$("#submitFlag").val(param);
    $("#inputForm").submit();
 }		
	
$(function(){
	$("#zd003Name").change(function(){
		$("#bizMnemonic").val(helpCode($("#zd003Name").val()))
	});
	
	$("#zd001WhTypeId").change(function(){
      $("#zd004Nature").val($("#zd001WhTypeId").find("option:selected").text());
	});
});
</script>

</head>

<body>

<form id="inputForm" action="" method="post">
<input type="hidden" id="id" name="id" value="${storage.id}"/>
<input type="hidden" id="bizVersion" name="bizVersion" value="${storage.bizVersion}"/>
<!-- 用于标识提交按钮 -->
<input type="hidden" id="submitFlag" value="" />
 <div class="pageContent" >
    <div class="panel">
         <table class="TableBlock" align="center">
         			<tr>
                    <td>编码:</td>
   		                 <td>
   		                <input type="text" id="zd002Code" name="zd002Code" disabled="disabled" style="width: 40%;"  value="${storage.zd002Code}" />
   		                 </td>
   		           </tr>
   		           <tr>
   		                  <td >名称:</td>
   		                 <td>
   		                <input type="text" id="zd003Name" name="zd003Name" style="width: 40%;" class="required" value="${storage.zd003Name}" />
   		                 </td>
   		           </tr>
                   <tr>
   		                 <td >助记码:</td>
   		                 <td>
   		                <input type="text" id="bizMnemonic" name="bizMnemonic" style="width: 40%;" value="${storage.bizMnemonic}" />
   		                 </td>  
   		           </tr>
   		           <tr>
                    	<td >责任人:</td>
   		                 <td>
   		                	<input type="text" id="zd006Person" name="zd006Person" style="width: 40%;" class="required" value="${storage.zd006Person}" />
   		                 </td>
   		           </tr>
   		            <tr>
   		              	<td >电话:</td>
   		                 <td>
   		                	<input type="text" id="zd007Tel" name="zd007Tel" style="width: 40%;" class="required" value="${storage.zd007Tel}" />
   		                 </td>    
   		           </tr>
   		            <tr>
   		                 <td >部门:</td>
   		                 <td>
   		                <input type="text" id="zd009Department" name="zd009Department" style="width: 40%;" value="${storage.zd009Department}" />
   		                 </td>
   		           </tr>
   		            <tr>
   		            <td >区域:</td>
   		                 <td>
   		                <input type="text" id="zd008Area" name="zd008Area" style="width: 40%;" value="${storage.zd008Area}" />
   		                 </td>
   		           </tr>
   		             <tr>
   		            <td >类型:</td>
   		                 <td>
   		                 <select id="zd001WhTypeId" name="zd001WhTypeId">
   		                   <option></option>
   		                   <c:forEach items='${storageTypeList}' var='whtype'>
   		                 		<option id="${whtype.id}" value='${whtype.id}'>${whtype.zd002Name}</option>
   		                 	</c:forEach>
   		                 	</select>
   		                 	<script type="text/javascript">
   		                 		$("#zd001WhTypeId").val('${storage.zd001WhTypeId}');
   		                 	</script>
   		                 <input type="hidden" id="zd004Nature" name="zd004Nature" style="width: 40%;" value="${storage.zd004Nature}" />
   		                </td>
   		           </tr>
   		             <tr>
   		            <td >最大库存:</td>
   		                 <td>
   		                <input type="text" id="zd012HighestInventory" name="zd012HighestInventory" style="width: 40%;" value="${storage.zd012HighestInventory}" />
   		                 </td>
   		           </tr>
   		             <tr>
   		            <td >最小库存:</td>
   		                 <td>
   		                <input type="text" id="zd013MinimumInventory" name="zd013MinimumInventory" style="width: 40%;" value="${storage.zd013MinimumInventory}" />
   		                 </td>
   		           </tr>
   		           <tr>
                    <td >地址:</td>
   		                 <td>
   		                <input type="text" id="zd005Address" name="zd005Address" style="width: 40%;" value="${storage.zd005Address}" />
   		                 </td>
   		           </tr>
   		           <tr>
   		           	<td >备注:</td>
   		           	<td colspan="3"><input id="zd014Remark" name="zd014Remark" style="width: 40%;" value="${storage.zd014Remark}" /></td>
   		           </tr>
                </table>               
         </div>
         <div class="formBar">
	        <ul>
		       <li><div class="buttonActive"><div class="buttonContent"><button type="button" id="save" onclick="submitForm(1)">保存</button></div></div></li>
		       <li><div class="button"><div class="buttonContent"><button type="button" class="print" onclick="CloseDialog()">关闭</button></div></div></li>
	        </ul>
        </div>    
    </div>
</form>
</body>
</html>
